package com.extension.company.view.my.localorder.localorderfragment;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.extension.company.admin.R;
import com.extension.company.model.entity.SameCityOrderAllBean;
import com.extension.company.common.mvc.BaseFragment;
import com.extension.company.common.utils.ToastUtil;
import com.extension.company.view.my.localorder.adapter.LocalCityAllAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;


/**
 * 同城 --所有的订单 fragement
 */
public class LocalCityOrderAllFragment extends BaseFragment {

	@BindView(R.id.list)
	RecyclerView recyclerView;

	private Context context;
	private List<SameCityOrderAllBean> list = new ArrayList<>();
	private LocalCityAllAdapter adapter;

	public static LocalCityOrderAllFragment newInstance() {
		LocalCityOrderAllFragment fragment = new LocalCityOrderAllFragment();
		return fragment;
	}


	@Override
	public void init() {
		recyclerView.setLayoutManager(new LinearLayoutManager(context));

		recyclerView.setLayoutManager(new GridLayoutManager(context, 1));
		adapter = new LocalCityAllAdapter(context, list);
		recyclerView.setAdapter(adapter);
		adapter.setOnListFragmentListener(new LocalCityAllAdapter.OnListFragmentInteractionListener() {
			@Override
			public void itemLeftBtn() {
				ToastUtil.showToast(context, "点击了左侧");
			}

			@Override
			public void itemRightBtn() {
				ToastUtil.showToast(context, "点击了右侧");

			}
		});

	}

	@Override
	public int getMainLayout() {
		return R.layout.fragment_item_list;
	}


	@Override
	public void onAttach(Context context) {
		super.onAttach(context);
		this.context = context;
	}

}
